﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:fn="http://www.w3.org/2005/xpath-functions">
<!--
程序名:权限初始化数据生成工具
版本号    修改者    修改时间    修改描述
1.0       liuleyi   20150609    创建此程序
-->
	<xsl:output method="text" indent="no" encoding="utf-8" byte-order-mark="no"/>  
	<xsl:template match="/">

<xsl:result-document encoding="utf-8" method="text" href="./generate/sql/InitData/init_Menu.sql">
/*
菜单初始化脚本
*/
<xsl:for-each select="Root">
<xsl:for-each select="LcCode">
<xsl:variable name="LcCode" select="@code"/>
DELETE t_mc_menu where lccode='<xsl:value-of select="$LcCode"/>';
DELETE t_mc_menu_permission  where lccode='<xsl:value-of select="$LcCode"/>';
<xsl:for-each select="System"><xsl:variable name="SystemType" select="@type"/><xsl:for-each select="FirstLevel">
<xsl:variable name="Fid" select="@id"/>
<xsl:variable name="ModuleCode" select="@Module"/>
INSERT INTO t_mc_menu (lccode,systemtype,appmodeltype,menuid,menuname,chineseabbr,menuparid,menuverification,dll,namespace,csharpclass,SSSformproperty,menuimagecode,updateoperid,updatedate,updatetime) values('<xsl:value-of select="$LcCode"/>','<xsl:value-of select="$SystemType"/>','<xsl:value-of select="$ModuleCode"/>','<xsl:value-of select="$Fid"/>','<xsl:value-of select="@title"/>','<xsl:value-of select="@nameabbr"/>',null,'<xsl:value-of select="@Verification"/>','<xsl:value-of select="@dll"/>','<xsl:value-of select="@namespace"/>','<xsl:value-of select="@class"/>','<xsl:value-of select="@SSSformproperty"/>','<xsl:value-of select="@ModulePic"/>','SSS',Pkg_Tool.Getoperdate(),Pkg_Tool.Getopertime());
<xsl:for-each select="SecondLevel">
<xsl:variable name="Sid" select="@id"/>
INSERT INTO t_mc_menu (lccode,systemtype,appmodeltype,menuid,menuname,chineseabbr,menuparid,menuverification,dll,namespace,csharpclass,SSSformproperty,menuimagecode,updateoperid,updatedate,updatetime) values('<xsl:value-of select="$LcCode"/>','<xsl:value-of select="$SystemType"/>','<xsl:value-of select="$ModuleCode"/>','<xsl:value-of select="$Sid"/>','<xsl:value-of select="@title"/>','<xsl:value-of select="@nameabbr"/>','<xsl:value-of select="$Fid"/>','<xsl:value-of select="@Verification"/>','<xsl:value-of select="@dll"/>','<xsl:value-of select="@namespace"/>','<xsl:value-of select="@class"/>','<xsl:value-of select="@SSSformproperty"/>','<xsl:value-of select="@ModulePic"/>','SSS',Pkg_Tool.Getoperdate(),Pkg_Tool.Getopertime());
<xsl:for-each select="ThirdLevel">
<xsl:variable name="Tid" select="@id"/>
INSERT INTO t_mc_menu (lccode,systemtype,appmodeltype,menuid,menuname,chineseabbr,menuparid,menuverification,dll,namespace,csharpclass,SSSformproperty,menuimagecode,updateoperid,updatedate,updatetime) values('<xsl:value-of select="$LcCode"/>','<xsl:value-of select="$SystemType"/>','<xsl:value-of select="$ModuleCode"/>','<xsl:value-of select="$Tid"/>','<xsl:value-of select="@title"/>','<xsl:value-of select="@nameabbr"/>','<xsl:value-of select="$Sid"/>','<xsl:value-of select="@Verification"/>','<xsl:value-of select="@dll"/>','<xsl:value-of select="@namespace"/>','<xsl:value-of select="@class"/>','<xsl:value-of select="@SSSformproperty"/>','<xsl:value-of select="@ModulePic"/>','SSS',Pkg_Tool.Getoperdate(),Pkg_Tool.Getopertime());
<xsl:for-each select="Permission">
INSERT INTO t_mc_menu_permission(lccode,systemtype,appmodeltype,menuid,permissionno,updateoperid,updatedate,updatetime) values('<xsl:value-of select="$LcCode"/>','<xsl:value-of select="$SystemType"/>','<xsl:value-of select="$ModuleCode"/>','<xsl:value-of select="$Tid"/>','<xsl:value-of select="@index"/>','SSS',Pkg_Tool.Getoperdate(),Pkg_Tool.Getopertime());
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
COMMIT;
</xsl:result-document>
	</xsl:template>  
</xsl:stylesheet>